package gui;

import java.awt.*;
import javax.swing.*;

public final class GraphicsUtil {
	private GraphicsUtil() {}
	public static void drawArrow(Graphics g,int x1, int y1,int x2,int y2) {
		g.drawLine(x1, y1, x2, y2);
		double ang = Math.atan2(y2-y1,x2-x1) - Math.PI;
		double len = Math.sqrt(Math.pow(x2-x1, 2)+Math.pow(y2-y1, 2));
		double angOff1 = ang - Math.PI/6;
		double angOff2 = ang + Math.PI/6;
		double length = len / 5;
		g.drawLine(x2,y2,(int)(x2+length*Math.cos(angOff1)),(int)(y2+length*Math.sin(angOff1)));
		g.drawLine(x2,y2,(int)(x2+length*Math.cos(angOff2)),(int)(y2+length*Math.sin(angOff2)));
	}
	public static void drawX(Graphics g, int x, int y, int size){
		g.drawLine(x, y, x+size, y+size);
		g.drawLine(x, y, x+size, y-size);
		g.drawLine(x, y, x-size, y-size);
		g.drawLine(x, y, x-size, y+size);
	}
	
}
